<?php

namespace App\Models;
class Balance extends Base
{
    const TYPE_MATERIAL = 1;
    const TYPE_APPOINT = 2;
    const TYPE_WITHDRAW = 3;

    protected $appends = ['amount_yuan', 'balance_yuan'];

    public function order() {
        return $this->belongsTo(Order::class, 'order_id');
    }

    public function getAmountYuanAttribute() {
        return format_yuan($this->amount);
    }

    public function getBalanceYuanAttribute($balance) {
        return format_yuan($this->balance);
    }
}
